package com.hcl.orm.sample.dao;

import com.hcl.orm.core.annotation.SqlCommandType;
import com.hcl.orm.core.annotation.DataAccess;
import com.hcl.orm.core.annotation.Script;
import com.hcl.orm.core.annotation.Selective;
import com.hcl.orm.core.executor.page.PageParam;
import com.hcl.orm.core.executor.page.PageResult;
import com.hcl.orm.sample.domain.Agency;

import java.util.List;

/**
 * @author hucl
 * @projectName jim-orm
 * @description: TODO
 * @date 2021/5/189:21
 */
@DataAccess
public interface AgencyDao {
    /**
     * 增加代理商
     *
     * @param agency
     * @return
     */
    @Script(command = SqlCommandType.INSERT, table = "prd_agency")
    @Selective
    int insertAgencySelective(Agency agency);

    /**
     * 增加代理商
     *
     * @param agency
     * @return
     */
    @Script(command = SqlCommandType.INSERT, table = "prd_agency")
    int insertAgency(Agency agency);

    /**
     * 批量增加代理商
     *
     * @param agencies
     * @return
     */
    @Script(command = SqlCommandType.INSERT, table = "prd_agency")
    void insertAgencies(List<Agency> agencies);

    /**
     * 更新代理商
     *
     * @param agency
     * @return
     */
    @Script(command = SqlCommandType.UPDATE, table = "prd_agency")
    @Selective
    int updateAgencyByPrimaryKeySelective(Agency agency);

    /**
     * 更新代理商
     *
     * @param agency
     * @return
     */
    @Script(command = SqlCommandType.UPDATE, table = "prd_agency")
    int updateAgencyByPrimaryKey(Agency agency);

    /**
     * 查询代理商
     *
     * @param agency
     * @return
     */
    @Script(command = SqlCommandType.SELECT, table = "prd_agency")
    Agency selectOneAgency(Agency agency);

    /**
     * 删除代理商
     *
     * @param agency
     * @return
     */
    @Script(command = SqlCommandType.DELETE, table = "prd_agency")
    int deleteOneAgency(Agency agency);

    /**
     * 分页查询
     *
     * @param pageParam
     * @return
     */
    @Script(table = "prd_agency")
    PageResult<Agency> queryAgencyPage(PageParam pageParam);
}
